package yunhe.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import yunhe.biz.ReceiptBiz;
import yunhe.entity.ReceiptFlow;
@WebServlet(name="ReceiveBillsServlet",urlPatterns="/ReceiveBillsServlet")
public class ReceiveBillsServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
	
		ReceiptBiz receiptbiz = new ReceiptBiz();
		List<ReceiptFlow> flows = receiptbiz.searchReceive();
		HttpSession session = request.getSession();
		if(flows!=null){
			session.setAttribute("flows", flows);
			request.getRequestDispatcher("receipt/ReceiveDetails.jsp").forward(request, response);
		}else{
			response.sendRedirect("index.jsp");
		}
		
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
}
